import React, { useState } from 'react';
import './header.scss';
import { Link } from 'react-router-dom';
import config from '@/config/index';

const Header = () => {
  const tab = [
    // { name: '跨境产品', url: '' },
    { name: '关于我们', url: '' },
    { name: '健康咨询', url: 'zixun' },
    { name: '健康知识', url: 'zhishi' },
  ];
  const [valIndex, setValIndex] = useState(0);
  function setValIndexFn(e) {
    setValIndex(e);
  }
  function collect() {
    alert('加入收藏失败，请使用Ctrl+D进行添加');
  }
  return (
    <>
      <div className="header-bg">
        <div className="body">
          <div>{config.greeting}</div>
          <div className="right">
            <span className="star" onClick={collect}>
              收藏本站{' '}
            </span>
            {/* <Link className="star" to={`contacts/1`}>
              消费通知书
            </Link> */}
          </div>
        </div>
      </div>
      <div className="logo">
        <div>
          <div className="logo-left" style={{ cursor: 'pointer' }}>
            <img style={{ width: '64px', height: '54px' }} alt="" src="../../src/assets/logo.jpg" />
            <div> {config.CompanyName}</div>
          </div>
          <div>
            <img
              style={{ width: '171px', height: '49px' }}
              alt=""
              src="../../src/assets/logo_r.jpg"
            />
          </div>
        </div>
        <div>
          <div>
            <img
              style={{ width: '20px', height: '31px' }}
              alt=""
              src="../../src/assets/f_tel.png"
            />
            <span>客服电话</span>
          </div>
          <div>{config.phone}</div>
        </div>
      </div>
      <div className="tab">
        <div>
          {tab.map((val, index) => (
            <Link
              onClick={() => setValIndexFn(index)}
              className={valIndex == index ? 'active' : ''}
              key={index}
              to={val.url}
            >
              {val.name}
            </Link>
          ))}
        </div>
      </div>
    </>
  );
};

export default Header;
